package net.csdn.business.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author likun
 * @date 2023/6/30 17:28
 */
@Getter
@AllArgsConstructor
public
enum UserTypeEnum {
    /**
     * 普通用户
     */
    USER("User", 0),
    /**
     * APP
     */
    BOT("Bot", 1),
    ;
    final String code;
    final Integer type;

    public static UserTypeEnum ofType(Integer type) throws IllegalArgumentException {
        for (UserTypeEnum userType : UserTypeEnum.values()) {
            if (userType.type.equals(type)) {
                return userType;
            }
        }
        throw new IllegalArgumentException("userType param error");
    }
}